package com.aps.entity;

import java.io.Serializable;

import com.aps.entity.eunm.ResultType;

import lombok.Data;

/**
 * @author liaoguangan
 * @description <>
 * @date 2018/4/6 9:26
 */

@Data
public class ResultEntity<T> implements Serializable {

    //操作是否成功
    private Boolean success;
    //返回信息
    private String message;
    //操作编码
    private int code;
    //返回数据
    private T data;

    public ResultEntity() {
    }

    public ResultEntity(T data) {
        this(true, ResultType.SUCCESS, data);
    }

    public ResultEntity(Boolean success, ResultType code, T data) {
        this(success, code.getDesc(), code, data);
    }

    public ResultEntity(Boolean success, String message, ResultType code, T data) {
        this.success = success;
        this.message = message;
        this.code = code.getCode();
        this.data = data;
    }
}
